GBML manual / Backgrounds

draw_self_on_floor

Draws this instance on the perspective floor: its x and y are a place on the picture, and it is drawn where the floor shows that place, sized by distance, nearer in front.

Game Boy: not available

Game Boy Color: not available

Sega Genesis: not built yet

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

draw_self_on_floor()

Returns

Nothing.

Description

Draws this instance on the perspective floor. The instance's x and y are a place on the picture (picture pixels, from its top-left corner), and it is drawn where the floor shows that place, sized by how far away it is, with the nearer instance in front.

Call it from the instance's Draw event (an object with a Draw event is not drawn by default). It uses the instance's own sprite, frame, flips and angle (set flip_x, or a negative image_xscale, and it is mirrored across, the same as in draw_self), and scales the picture smoothly by distance: a scaled sprite takes one of the console's 32 turn-and-size slots, and at scale 1 it takes none. The sprite's own origin is put on the floor, so set the origin at the feet (a car's belly, a pickup's base).

Nothing is drawn when the place is behind the camera or past the horizon.

Because x and y stay places on the picture, everything that works in the room works on the floor: collision_rect, masks, dist_to, motion. They do not depend on where the camera is. Give the room the picture's size, and switch Release off view off for these objects (an object off the screen is otherwise released).

Example

// Draw event of a pickup lying on the road.
draw_self_on_floor();

The pickup is drawn on the road at its own place, small in the distance and bigger as the camera comes near.

On the GBA

Call it from the instance’s Draw event (an object with a Draw event is not drawn by default). It uses the instance’s own sprite, frame, flips and angle (flip_x, or a negative image_xscale, mirrors it across, as in draw_self), scales the picture smoothly by distance (a scaled sprite takes one of the console’s limited turn-and-size slots; at scale 1 it takes none) and puts the sprite’s own origin on the floor, so set the origin at the feet (a car’s belly). Nothing is drawn when the place is behind the camera or past the horizon. The instance’s x and y stay floor places, so collision_rect and masks work in picture pixels whatever the camera does: give the room the picture’s size and switch Release off view off for these objects.

See also: Perspective floordraw_sprite_on_floorfloor_scale_atperspective_floor_projectdraw_self